package iut.acy.retardeleve;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class Detail extends Activity implements OnClickListener{

	
	/*private static final String FLAG_SUCCESS = "success";
	private static final String FLAG_MESSAGE = "message";
	private static final String LOGIN_URL = "http://retard.hol.es";*/
	
	private static Retard retardDetail;
	
	private Button retour;
	
	private TextView tvNomProf;
	private TextView tvDuree;
	private TextView tvHeure;
	private TextView tvTravail;
	
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.detail_content);
		
		this.tvNomProf = (TextView)findViewById(R.id.tvNomProfDetail);
		this.tvDuree = (TextView)findViewById(R.id.tvDureeDetail);
		this.tvHeure = (TextView)findViewById(R.id.tvHeureDetail);
		this.tvTravail = (TextView)findViewById(R.id.tvTravailDetail);
		
		this.afficheDetail();
		
		this.retour = (Button)findViewById(R.id.butRetour);
		this.retour.setOnClickListener(this);
		
	}

	public void afficheDetail()
	{
		this.tvNomProf.setText(retardDetail.getNomProf()+" "+retardDetail.getPrenomProf());
		this.tvDuree.setText(retardDetail.getDureeRetard()+" minutes");
		this.tvHeure.setText(retardDetail.getHeureCours()+" heure");
		this.tvTravail.setText(retardDetail.getTravail());
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) 
	{
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	public void onClick(View v)
	{
		switch(v.getId())
		{
			case R.id.butRetour:
				this.finish();
				break;
			default : 
				break;
		}		
	}

	public static Retard getRetardDetail() {
		return retardDetail;
	}

	public static void setRetardDetail(Retard retardDetail) {
		Detail.retardDetail = retardDetail;
	}

	public Button getRetour() {
		return retour;
	}

	public void setRetour(Button retour) {
		this.retour = retour;
	}
	
	
	
}
